# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Rasmus Thomsen <oss@cogitri.dev>
pkgname=mutter
pkgver=3.36.4
pkgrel=0
pkgdesc="clutter-based window manager and compositor"
url="https://wiki.gnome.org/Projects/Mutter/"
arch="all !s390x !mips !mips64" # limited by gnome-settings-daemon
license="GPL-2.0-or-later"
depends="xkeyboard-config zenity gsettings-desktop-schemas xorg-server-xwayland"
makedepends="gnome-desktop-dev libcanberra-dev upower-dev json-glib-dev
	libxkbcommon-dev libxkbfile-dev wayland-protocols clutter-dev cogl-dev
	libgudev-dev libinput-dev gnome-common itstool libxml2-utils
	libxcomposite-dev libxdamage-dev elogind-dev meson pipewire-dev
	gnome-settings-daemon-dev libice-dev libsm-dev startup-notification-dev
	xorg-server graphene-dev"
options="!check" # Can't be run with release builds
subpackages="$pkgname-dev $pkgname-doc $pkgname-lang $pkgname-dbg"
source="https://download.gnome.org/sources/mutter/${pkgver%.*}/mutter-$pkgver.tar.xz
	fix-cogl-path-build-ordering.patch
	fixudev-req.patch"

prepare() {
	default_prepare
	# disable test subdirs, causes looping on builders and we don't run
	# tests anyway
	sed -e '/subdir/d' -i cogl/tests/meson.build
}

build() {
	meson \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--localstatedir=/var \
		--buildtype=plain \
		-Degl_device=true \
		-Dudev=true \
		-Dnative_backend=true \
		-Dintrospection=true \
		-Dxwayland_path=/usr/bin/Xwayland \
		-Dremote_desktop=true \
		-Dprofiler=false \
		. output
	ninja -C output
}

package() {
	DESTDIR="$pkgdir" ninja -C output install
}

sha512sums="e7130e59d5539a53ac8a349a38ce1ce757c6eee2ba672fc9eab9330bde32217674a9a206bd977db03195dc42b6c327147467407dd0159c4e8585332d9c1daabb  mutter-3.36.4.tar.xz
d2f80806bcd913779c11fb949b1b553f256b2ca9e8aeb1c3c01befb3b84c023e41affd1e966326b77d55b28f2d71c5931eb488abf6cd7504f0ee8cb35ed5b37d  fix-cogl-path-build-ordering.patch
6f21171bbd0ad0fc67cbaf5fb1478b22b482a9ae33b9328cc51a5dd31bcf7d95cd41e6cbbac21d3d8801cc064a62a64ae38ed7d0501ab605b861058c32f3bc30  fixudev-req.patch"
